/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.admin.service;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
 * 验证码接口
 *
 * @author 挺好的 挺好的 2023年06月05日 14:43
 */
public interface CaptchaService {

    /**
     * 验证码名称
     */
    String CAPTCHA_ATTRIBUTE_NAME = "captcha";

    /**
     * 创建验证码
     *
     * @param request
     *         {@link HttpServletRequest }
     * @param response
     *         {@link HttpServletResponse}
     */
    void create (HttpServletRequest request, HttpServletResponse response);

    /**
     * 是否有效
     *
     * @param request
     *         {@link HttpServletRequest }
     * @param captcha
     *         验证码
     *
     * @return captcha is empty || 不正确，返回false
     */
    boolean isValid (HttpServletRequest request, String captcha);
}
